# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=tilt
pkgname=ruby-tilt
pkgver=2.0.11
pkgrel=1
pkgdesc='Generic interface to multiple Ruby template engines'
url='https://github.com/rtomayko/tilt'
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('ruby-ronn' 'ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/rtomayko/tilt/archive/v${pkgver}.tar.gz)
sha256sums=('0c4b11ced879326206e564852cd5f52e1db343760bfe5e3891b6cf19b0b154f8')
sha512sums=('e28e31ab92aa42eada34e0f6c05dab6a54945d07b649588356b1635ba8a36700f6e537e8702613883693501442d21690d8b3690b06f7b9f331192134511b78b7')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec # don't give a fuck about rubys bla bla
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
  ronn -w -s toc -r5 --markdown man/*.ronn
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.md CHANGELOG.md man/tilt.1.{markdown,html} -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 man/tilt.1 -t "${pkgdir}/usr/share/man/man1"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"
}

# vim: ts=2 sw=2 et:
